<template>
	<view>
		<u-form :model="form" ref="uForm" style="margin: 0 20rpx;">
			<u-form-item label-width="200" label="*服务器地址" prop="url">
				<u-input v-model="form.url" />
			</u-form-item>
			<u-form-item label-width="200" label="*Netty地址" prop="nettyUrl">
				<u-input v-model="form.nettyUrl" />
			</u-form-item>
			<u-form-item label-width="200" label="*PDF预览地址" prop="pdfUrl">
				<u-input v-model="form.pdfUrl" />
			</u-form-item>
		</u-form>
		<view style="text-align: center;margin-top: 20rpx;">
			<u-button size="medium" shape="circle" type="primary" @click="submit" :ripple="true"
				ripple-bg-color="#a0cfff">提交</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					url: 'http://127.0.0.1:8100',
					nettyUrl: 'ws://127.0.0.1:8090/ws',
					pdfUrl: 'http://127.0.0.1:8100'
				}
			};
		},
		methods: {
			submit() {
				uni.setStorage({
					key: "server_url",
					data: JSON.stringify(this.form),
					success: (res) => {
						uni.reLaunch({
						  url: '/pages/login/login'
						})
					},
					fail: (err) => {
						this.$u.toast("请重试！");
					}
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
